package com.zmq.pic.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * 人物 entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_figure")
public class PicFigure extends com.zmq.pic.entity.BaseEntity implements
		java.io.Serializable {

	private static final long serialVersionUID = 1919050317744950656L;
	// Fields

	private Long id;
	/**
	 * 群组
	 */
	private PicFigureGroup picFigureGroup;
	/**
	 * 姓名
	 */
	private String name;
	/**
	 * 性别
	 */
	private Integer gender;
	/**
	 * 生日
	 */
	private String birthday;
	/**
	 * 邮箱
	 */
	private String email;
	/**
	 * 家庭电话
	 */
	private String tel;
	/**
	 * 手机
	 */
	private String mobile;
	/**
	 * 住址
	 */
	private String address;
	/**
	 * 人物关系
	 */
	private Set<PicUserFigure> picUserFigures = new HashSet<PicUserFigure>(0);

	// Constructors

	/** default constructor */
	public PicFigure() {
	}

	/** full constructor */
	public PicFigure(PicFigureGroup picFigureGroup, String name,
			Integer gender, String birthday, String email, String tel,
			String mobile, String address, Set<PicUserFigure> picUserFigures) {
		this.picFigureGroup = picFigureGroup;
		this.name = name;
		this.gender = gender;
		this.birthday = birthday;
		this.email = email;
		this.tel = tel;
		this.mobile = mobile;
		this.address = address;
		this.picUserFigures = picUserFigures;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "GROUP_ID", unique = true)
	public PicFigureGroup getPicFigureGroup() {
		return this.picFigureGroup;
	}

	public void setPicFigureGroup(PicFigureGroup picFigureGroup) {
		this.picFigureGroup = picFigureGroup;
	}

	@Column(name = "NAME", length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "GENDER")
	public Integer getGender() {
		return this.gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	@Column(name = "BIRTHDAY", length = 64)
	public String getBirthday() {
		return this.birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	@Column(name = "EMAIL", length = 64)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "TEL", length = 64)
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "MOBILE", length = 64)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "ADDRESS", length = 128)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picFigure")
	public Set<PicUserFigure> getPicUserFigures() {
		return this.picUserFigures;
	}

	public void setPicUserFigures(Set<PicUserFigure> picUserFigures) {
		this.picUserFigures = picUserFigures;
	}

	@Override
	public String toString() {
		return "PicFigure [address=" + address + ", birthday=" + birthday
				+ ", email=" + email + ", gender=" + gender + ", id=" + id
				+ ", mobile=" + mobile + ", name=" + name + ", picFigureGroup="
				+ picFigureGroup + ", picUserFigures=" + picUserFigures
				+ ", tel=" + tel + "]";
	}

	
}